<?php
	
	
	class Index{
		
		// Index page of the total website.
		public function _index(){
			
			// If the user is logged in... redirect him to his homepage.
			if(data('fb')->user !== 0){
				header('Location: ' . URL . 'index/home');
			}
			
			displayView('index');
		}
		
		// Homepage of the users.
		public function home(){
			if(data('fb')->user === 0){
				header('Location: ' . URL);
			}
			
			$users = new Users();
			data('header', $users->read(data('fb')->user, array('id', 'firstName')));
			data('firstFriend', $users->readFirstfriend(data('fb')->user));
			displayView('home');
		}
		
		public function logout(){
			session_destroy();
			header('Location: ' . URL);
		}
	}

// File end.